package com.xd.common.config;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;// 示例：自定义 Page 序列化器
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.github.pagehelper.Page;
import com.xd.core.business.vo.BillInfoVo;

import java.io.IOException;

public class PageSerializer extends JsonSerializer<Page<?>> {
    @Override
    public void serialize(Page<?> value, JsonGenerator gen, SerializerProvider serializers) throws IOException, IOException {
        gen.writeStartObject();
        gen.writeNumberField("total", value.getTotal());
        gen.writeNumberField("pageNum", value.getPageNum());
        gen.writeNumberField("pageSize", value.getPageSize());
        gen.writeNumberField("pages", value.getPages());
        gen.writeNumberField("startRow", value.getStartRow());
        gen.writeNumberField("endRow", value.getEndRow());
        gen.writeNumberField("size", value.size());
        gen.writeBooleanField("count", value.isCount());
        gen.writeObjectField("list", value.getResult());
        gen.writeEndObject();
    }
}


   